import {useLocation} from "react-router-dom";

export const useQueryString = function(){
    const {search} = useLocation();// [id=1,type=2]
    let obj = {};
    search.slice(1).split("&").forEach(item=>{
        const [key,value]=item.split("=");
        obj[key] = value;
    })
    return obj;
}